package com.example.lvsuo.controller;


import com.example.lvsuo.aop.Flow;
import com.example.lvsuo.aop.MoKuaiEnum;
import com.example.lvsuo.entity.CaseDecrease;
import com.example.lvsuo.entity.vo.CaseDecreaseVo;
import com.example.lvsuo.modal.Result;
import com.example.lvsuo.service.ICaseDecreaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 * 费用减免 前端控制器
 * </p>
 *
 * @author 心心念念
 * @since 2021-03-30
 */
@RestController
@RequestMapping("/caseDecrease")
public class CaseDecreaseController {

    @Autowired
    ICaseDecreaseService cs;

    @Flow(tName = "case_decrease",KUAI_ENUM = MoKuaiEnum.FYJMSQ)
    @PostMapping
    Result addCaseDecrease(@Valid CaseDecrease c){
        cs.save(c);
        return Result.back("成功");
    }

    @GetMapping
    Result queryCaseDecrease(CaseDecreaseVo c){
        return Result.back(cs.queryCaseDecrease(c));
    }
    //传入案件id 查询一整条数据
    @GetMapping("/id/case_decrease")
    Result getCaseLawid(CaseDecrease c){

        return Result.back( cs.getCaseLawid(c));
    }
}

